﻿<?xml version="1.0" encoding="utf-8"?>
<ResourceDictionary 
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:testSliderWinPhone8"
	xmlns:controls="clr-namespace:Coding4Fun.Toolkit.Controls"
	xmlns:c4fConverters="clr-namespace:Coding4Fun.Toolkit.Controls.Converters">

	<c4fConverters:SolidColorBrushToColorConverter x:Key="BrushToBrush" />

	<SolidColorBrush x:Key="DefaultDisabledBrush" Color="{Binding Source={StaticResource PhoneDisabledBrush}, Converter={StaticResource BrushToBrush}}" />

	
	<Style TargetType="controls:ColorSliderThumb">
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="controls:ColorSliderThumb">
					<Grid>
						<Rectangle Stroke="Black" StrokeThickness="6" />
						<Rectangle Stroke="White" StrokeThickness="3" />
					</Grid>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>

	<Style TargetType="controls:ColorSlider2">
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="controls:ColorSlider2">
					<Grid Name="Body">
						<VisualStateManager.VisualStateGroups>
							<VisualStateGroup x:Name="CommonStates">
								<VisualState x:Name="Normal" />
								<VisualState x:Name="Disabled">
									<Storyboard>
										<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Fill" Storyboard.TargetName="HorizontalSelectedColor">
											<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource DefaultDisabledBrush}" />
										</ObjectAnimationUsingKeyFrames>
										<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="HorizontalSlider">
											<DiscreteObjectKeyFrame KeyTime="0" Value="Transparent" />
										</ObjectAnimationUsingKeyFrames>
										<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Fill" Storyboard.TargetName="VerticalSelectedColor">
											<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource DefaultDisabledBrush}" />
										</ObjectAnimationUsingKeyFrames>
										<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="VerticalSlider">
											<DiscreteObjectKeyFrame KeyTime="0" Value="Transparent" />
										</ObjectAnimationUsingKeyFrames>
									</Storyboard>
								</VisualState>
							</VisualStateGroup>
						</VisualStateManager.VisualStateGroups>
						<Grid Name="HorizontalTemplate">
							<Grid.ColumnDefinitions>
								<ColumnDefinition />
								<ColumnDefinition Width="Auto" />
							</Grid.ColumnDefinitions>

							<controls:SuperSliderUpdate
								Grid.Column="0"
								Margin="0"
								Name="HorizontalSlider" 
								Orientation="{TemplateBinding Orientation}" 
								Foreground="Transparent" 
								Minimum="0" Maximum="360" 
								VerticalPadding="0"
								HorizontalPadding="0"
								FillSize="{TemplateBinding DefaultSize}"
								TrackSize="{TemplateBinding DefaultSize}"
								DisableTrackOpacity="1"
								/>
							<Rectangle
								Grid.Column="1"
								Name="HorizontalSelectedColor" 
								Margin="10, 0, 0, 0"
								Fill="{TemplateBinding SolidColorBrush}"
								Width="{TemplateBinding SelectedColorSize}"
								/>
						</Grid>
						<Grid Name="VerticalTemplate">
							<Grid.RowDefinitions>
								<RowDefinition />
								<RowDefinition Height="Auto" />
							</Grid.RowDefinitions>

							<controls:SuperSliderUpdate
								Grid.Row="0"
								Margin="0"
								Name="VerticalSlider" 
								Orientation="{TemplateBinding Orientation}" 
								Foreground="Transparent" 
								Minimum="0" Maximum="360" 
								VerticalPadding="0"
								HorizontalPadding="0"
								FillSize="{TemplateBinding DefaultSize}"
								TrackSize="{TemplateBinding DefaultSize}"
								DisableTrackOpacity="1"
								/>
							<Rectangle
								Grid.Row="1"
								Name="VerticalSelectedColor" 
								Margin="0, 10, 0, 0"
								Fill="{TemplateBinding SolidColorBrush}"
								Height="{TemplateBinding SelectedColorSize}"
								/>
						</Grid>
					</Grid>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>

	<Style TargetType="local:SuperSlider">
		<Setter Property="BorderThickness" Value="0"/>
		<Setter Property="BorderBrush" Value="Transparent"/>
		<Setter Property="Maximum" Value="10"/>
		<Setter Property="Minimum" Value="0"/>
		<Setter Property="Value" Value="0"/>
		<Setter Property="Background" Value="{StaticResource PhoneChromeBrush}"/>
		<Setter Property="Foreground" Value="{StaticResource PhoneAccentBrush}"/>
		<Setter Property="HorizontalPadding" Value="12, 22, 12, 50" />
		<Setter Property="VerticalPadding" Value="18, 12" />
		<Setter Property="TrackSize" Value="12" />
		<Setter Property="FillSize" Value="12" />
		<Setter Property="MinHeight" Value="24" />
		<Setter Property="MinWidth" Value="24" />
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="local:SuperSlider">
					<Grid Background="Transparent">
						<VisualStateManager.VisualStateGroups>
							<VisualStateGroup x:Name="CommonStates">
								<VisualState x:Name="Normal"/>
								<VisualState x:Name="MouseOver"/>
								<VisualState x:Name="Disabled">
									<Storyboard>
										<DoubleAnimation Duration="0" To="{Binding DisableTrackOpacity, RelativeSource={RelativeSource TemplatedParent}}" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="HorizontalTrack"/>
										<DoubleAnimation Duration="0" To="{Binding DisableTrackOpacity, RelativeSource={RelativeSource TemplatedParent}}" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="VerticalTrack"/>
										<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Fill" Storyboard.TargetName="HorizontalFill">
											<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource DefaultDisabledBrush}"/>
										</ObjectAnimationUsingKeyFrames>
										<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Fill" Storyboard.TargetName="VerticalFill">
											<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource DefaultDisabledBrush}"/>
										</ObjectAnimationUsingKeyFrames>
									</Storyboard>
								</VisualState>
							</VisualStateGroup>
						</VisualStateManager.VisualStateGroups>
						<Grid x:Name="HorizontalTemplate" Margin="{TemplateBinding HorizontalPadding}">
							<Grid>
								<Rectangle x:Name="HorizontalTrack" Fill="{TemplateBinding Background}" Height="{TemplateBinding TrackSize}" IsHitTestVisible="False" />
								<Rectangle x:Name="HorizontalFill" Fill="{TemplateBinding Foreground}" Height="{TemplateBinding FillSize}" IsHitTestVisible="False" >
									<Rectangle.Clip>
										<RectangleGeometry x:Name="HorizontalRectClip" /> 
										<!-- Rect="0, 0, 0, 50"  x, y, width, height -->
									</Rectangle.Clip>
								</Rectangle>
								<ContentPresenter Name="HorizontalCenterElement" HorizontalAlignment="Left">
									<ContentPresenter.RenderTransform>
										<TranslateTransform x:Name="HorizontalThumbTransform"/>
									</ContentPresenter.RenderTransform>
									<Rectangle Fill="{StaticResource PhoneForegroundBrush}" Height="24" Width="12" />
								</ContentPresenter>
							</Grid>
						</Grid>
						<Grid x:Name="VerticalTemplate" Margin="{TemplateBinding VerticalPadding}">
							<Grid>
								<Rectangle x:Name="VerticalTrack" Fill="{TemplateBinding Background}" IsHitTestVisible="False" Width="{TemplateBinding TrackSize}"/>
								<Rectangle x:Name="VerticalFill" Fill="{TemplateBinding Foreground}" IsHitTestVisible="False" Width="{TemplateBinding FillSize}">
									<Rectangle.Clip>
										<RectangleGeometry x:Name="VerticalRectClip"  />
										<!-- Rect="0, 0, 12, 6" -->
									</Rectangle.Clip>
								</Rectangle>
								<ContentPresenter Name="VerticalCenterElement" VerticalAlignment="Top">
									<ContentPresenter.RenderTransform>
										<TranslateTransform x:Name="VerticalThumbTransform" />
									</ContentPresenter.RenderTransform>
									<Rectangle Fill="{StaticResource PhoneForegroundBrush}" Height="12" Width="24" />
								</ContentPresenter>
							</Grid>
						</Grid>
					</Grid>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>

    <Style TargetType="controls:SuperSliderUpdate">
		<Setter Property="BorderThickness" Value="0"/>
		<Setter Property="BorderBrush" Value="Transparent"/>
		<Setter Property="Maximum" Value="10"/>
		<Setter Property="Minimum" Value="0"/>
		<Setter Property="Value" Value="0"/>
		<Setter Property="Background" Value="{StaticResource PhoneChromeBrush}"/>
		<Setter Property="Foreground" Value="{StaticResource PhoneAccentBrush}"/>
		<Setter Property="HorizontalPadding" Value="12, 22, 12, 50" />
		<Setter Property="VerticalPadding" Value="18, 12" />
		<Setter Property="TrackSize" Value="12" />
		<Setter Property="FillSize" Value="12" />
		<Setter Property="MinHeight" Value="24" />
		<Setter Property="MinWidth" Value="24" />
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="controls:SuperSliderUpdate">
					<Grid Background="Transparent"  Name="Body">
						<VisualStateManager.VisualStateGroups>
							<VisualStateGroup x:Name="CommonStates">
								<VisualState x:Name="Normal"/>
								<VisualState x:Name="MouseOver"/>
								<VisualState x:Name="Disabled">
									<Storyboard>
										<DoubleAnimation Duration="0" To="{Binding DisableTrackOpacity, RelativeSource={RelativeSource TemplatedParent}}" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="HorizontalTrack"/>
										<DoubleAnimation Duration="0" To="{Binding DisableTrackOpacity, RelativeSource={RelativeSource TemplatedParent}}" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="VerticalTrack"/>
										<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Fill" Storyboard.TargetName="HorizontalFill">
											<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource DefaultDisabledBrush}"/>
										</ObjectAnimationUsingKeyFrames>
										<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Fill" Storyboard.TargetName="VerticalFill">
											<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource DefaultDisabledBrush}"/>
										</ObjectAnimationUsingKeyFrames>
									</Storyboard>
								</VisualState>
							</VisualStateGroup>
						</VisualStateManager.VisualStateGroups>
						<Grid x:Name="HorizontalTemplate" Margin="{TemplateBinding HorizontalPadding}">
							<Rectangle x:Name="HorizontalTrack" Fill="{TemplateBinding Background}" Height="{TemplateBinding TrackSize}" IsHitTestVisible="False" />
							<Rectangle x:Name="HorizontalFill" Fill="{TemplateBinding Foreground}" Height="{TemplateBinding FillSize}" IsHitTestVisible="False" HorizontalAlignment="Left" />
							
							<ContentPresenter Name="HorizontalCenterElement" HorizontalAlignment="Left">
								<ContentPresenter.RenderTransform>
									<TranslateTransform/>
								</ContentPresenter.RenderTransform>
								<Rectangle Fill="{StaticResource PhoneForegroundBrush}" Height="24" Width="12" />
							</ContentPresenter>
						</Grid>
						<Grid x:Name="VerticalTemplate" Margin="{TemplateBinding VerticalPadding}">
							<Rectangle x:Name="VerticalTrack" Fill="{TemplateBinding Background}" IsHitTestVisible="False" Width="{TemplateBinding TrackSize}"/>
							<Rectangle x:Name="VerticalFill" Fill="{TemplateBinding Foreground}" IsHitTestVisible="False" Width="{TemplateBinding FillSize}" VerticalAlignment="Bottom" />
							<ContentPresenter Name="VerticalCenterElement" VerticalAlignment="Bottom">
								<ContentPresenter.RenderTransform>
									<TranslateTransform/>
								</ContentPresenter.RenderTransform>
								<Rectangle Fill="{StaticResource PhoneForegroundBrush}" Height="12" Width="24" />
							</ContentPresenter>
						</Grid>
					</Grid>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>

	<Style TargetType="controls:SuperSliderWp7">
		<Setter Property="Background" Value="{StaticResource PhoneChromeBrush}" />
		<Setter Property="Foreground" Value="{StaticResource PhoneAccentBrush}" />
		<Setter Property="Padding" Value="0, 3, 0, 36" />
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="controls:SuperSliderWp7">
					<Grid Name="Body">
						<Grid.RowDefinitions>
							<RowDefinition Height="Auto" />
							<RowDefinition />
						</Grid.RowDefinitions>
						<VisualStateManager.VisualStateGroups>
							<VisualStateGroup x:Name="CommonStates">
								<VisualState x:Name="Normal" />
								<VisualState x:Name="Disabled">
									<Storyboard>
										<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Fill" Storyboard.TargetName="ProgressRectangle">
											<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource DefaultDisabledBrush}" />
										</ObjectAnimationUsingKeyFrames>
										<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Fill" Storyboard.TargetName="BackgroundRectangle">
											<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneChromeBrush}" />
										</ObjectAnimationUsingKeyFrames>
									</Storyboard>
								</VisualState>
							</VisualStateGroup>
						</VisualStateManager.VisualStateGroups>
						<Grid Grid.Row="1">
							<Border Margin="{TemplateBinding Padding}">
								<Grid Name="BarBody">
									<Rectangle Grid.Row="1" Name="BackgroundRectangle" Fill="{TemplateBinding Background}" />
									<Rectangle Grid.Row="1" Name="ProgressRectangle" Fill="{TemplateBinding Foreground}" />
									<ContentPresenter Grid.Row="1" Content="{TemplateBinding Thumb}" />
								</Grid>
							</Border>
						</Grid>
					</Grid>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>

</ResourceDictionary>
	